package com.blockchain.securewallet.tools;

import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;

/**
 * Created by Lopez on 2018/6/12.
 */
public class TipsWatcher implements TextWatcher {

    private View tv;
    private boolean isInvisible;

    public TipsWatcher(View tv) {
        this.tv = tv;
    }

    public TipsWatcher(View tv, boolean isInvisible) {
        this.tv = tv;
        this.isInvisible = isInvisible;
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        if (tv.getVisibility() == View.VISIBLE) {
            if (isInvisible) {
                tv.setVisibility(View.INVISIBLE);
            } else {
                tv.setVisibility(View.GONE);
            }
        }
    }

    @Override
    public void afterTextChanged(Editable s) {

    }

}
